$(function () {
    $(".loadingMarsk").css({
        "width": window.screen.availWidth,
        "height": window.screen.availHeight,
    });
    new FastClick(document.body);
    //节流阀
    var flag = false;
    function loadPointData(status) {
        if (flag) return false;
        $.ajax({
            type: "get",
            url: domain.test + "/getpoint",
            // url: domain.online + "/api/custom", 
            dataType: "json",
            beforeSend: function () {
                if (status === 0) {
                    $(".loadingMarsk").css("display", "block");
                }
                flag = true;
            },
            success: function (response) {
                if (response.data.rtnCode === 200) {
                    // if(response.rtnCode===200) {
                    var pointDetail = response.data.data;
                    // var pointDetail = response.data;
                    $(".contentBox").html(template("contentBox", { pointDetail: pointDetail }));
                    pullmaster.pullDownSuccess();
                    flag = false;
                    if(status===0) {
                        $(".loadingMarsk").css("display", "none");
                    }
                }
            }
        });
    }
    loadPointData(0);
    var pullmaster = new Pull($('.contentBox'), {
        onPullDown: function () {
            loadPointData(1);
        }
    });
    //host详情
    $(".contentBox").on("click", ".productItem", function () {
        var pId = $(this).attr("data-id");
        location.href = "../classify/product.html?id=" + pId;
    });
    //custom详情
    $(".contentBox").on("click", ".customItem", function () {
        var pId = $(this).attr("data-id");
        location.href = "../classify/product.html?id=" + pId;
    });
});